<%@page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="../vendor/font-awesome/css/font-awesome.min.css">
    <!-- Custom Font Icons CSS-->
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/layer.css">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="../css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="../css/custom.css">
    <title>会议系统</title>

</head>
<body>
<%@include file="../publicjsp/head.jsp"%>

<div class="d-flex align-items-stretch">
    <!-- Sidebar Navigation-->
    <nav id="sidebar">
        <!-- Sidebar Header-->
        <%@ include file="../publicjsp/sidhead.jsp"%>
        <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
        <%@ include file="../publicjsp/sidenav.jsp"%>

    </nav>
    <!-- Sidebar Navigation end-->
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">会议系统</h2>
            </div>
        </div>

        <section class="no-padding-bottom">

            <div class="list-group myList">
                <!--搜索文章的条件-->
                <div class="myTitle">
                    <form class="form-inline" method="post" action="${pageContext.request.contextPath}/dept/system">
                        <div class="form-group">
                            <label for="inlineFormInput" class="sr-only">Name</label>
                            <input name="name" id="inlineFormInput" value="${name}" type="text" placeholder="按标题名字查找" class="mr-sm-3 form-control">
                        </div>
                        <div class="form-group">
                            <input type="submit" value="查询" class="btn btn-primary">
                        </div>
                        <!--选择部门-->
                        <div class="form-group">
                            <select name="dep" class="form-control">

                                <c:forEach var="dept" items="${dept}">
                                    <%--<c:if test="${list.dept_id != dept.id}">--%>
                                        <%--<option>${dept.name}</option>--%>
                                    <%--</c:if>--%>
                                    <option>${dept.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </form>

                    <input id="AddMeeting" type="submit" value="发布会议" class="btn btn-primary">


                </div>

                <ul>

                    <c:forEach items="${list}" var="list">
                        <li class="list-group-item">
                            <div style="float: right;">
                                <c:if test="${list.status == 0}">
                                    <span><strong>状态：</strong>未开始</span>
                                </c:if>
                                <c:if test="${list.status == 1}">
                                    <span><strong>状态：</strong>正在进行</span>
                                </c:if>
                                <c:if test="${list.status == 2}">
                                    <span><strong>状态：</strong>已结束</span>
                                </c:if>
                            </div>
                            <a href="${pageContext.request.contextPath}/dept/show?id=${list.id}">${list.title}</a>
                            <p class="h6"><strong>部门：</strong>${list.dept_name}</p>
                            <p class="h6"><strong>日期：</strong>${list.publish_date}</p>
                            <p style="white-space:nowrap;overflow:hidden;text-overflow: ellipsis">${list.content}</p>
                        </li>
                    </c:forEach>


                </ul>

                <nav class="text-center" aria-label="Page navigation">
                    <ul class="pagination">
                        <li>
                            <a id="pre" href="JavaScript:;" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <c:forEach varStatus="vs" begin="${startPage}" end="${endPage}" step="1">
                            <c:if test="${vs.index == currentPage}">
                                <li><a class="bor one" href="JavaScript:;">${vs.index}</a></li>
                            </c:if>

                            <c:if test="${vs.index != currentPage}">
                                <li><a class="one" id="two" href="JavaScript:;">${vs.index}</a></li>
                            </c:if>
                        </c:forEach>
                        <li>
                            <a id="next" href="JavaScript:;" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </section>

        <%@include file="../publicjsp/footer.jsp"%>
    </div>
</div>

<!-- JavaScript files-->
<script src="${pageContext.request.contextPath}/vendor/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/vendor/popper.js/umd/popper.min.js"></script>
<script src="${pageContext.request.contextPath}/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/vendor/jquery.cookie/jquery.cookie.js"></script>
<script src="${pageContext.request.contextPath}/vendor/chart.js/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/vendor/jquery-validation/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/js/charts-home.js"></script>
<script src="${pageContext.request.contextPath}/js/front.js"></script>
<script src="${pageContext.request.contextPath}/js/layer.js"></script>
<script src="${pageContext.request.contextPath}/js/custom.js"></script>


<script>


    $(".one").on("click",function () {
        let page = $(this).html();
        let name = $("#inlineFormInput").val();
        console.log(page);
        console.log(name);
        if (null === name || '' === name){
            window.location.href = '${pageContext.request.contextPath}/dept/system?page='+page;
        } else {
            window.location.href = '${pageContext.request.contextPath}/dept/system?page='+page+"&name="+name;
        }
    });

    $("#next").on("click",function () {
        let page = parseInt('${startPage}') + parseInt('${pageCount}');
        let pageTotal = parseInt('${pageTotal}');
        if (page > pageTotal) {
            // alert("已经到底页了");
            layer.msg("已经到底页了")
            return
        }
        <%--window.location.href = '${pageContext.request.contextPath}/article/lookRelease?page=' + page;--%>
    });
    $("#pre").on("click",function () {
        let page = parseInt('${startPage}') - 1;
        if (page === 0) {
            // alert("这已经是顶页了");
            layer.msg("这已经是顶页了");
            return;
        }
        <%--window.location.href = '${pageContext.request.contextPath}/article/lookRelease?page=' + page;--%>
    });

    $("#AddMeeting").on("click",function () {
        window.location.href = '${pageContext.request.contextPath}/dept/AddMeeting';
    })


</script>


</body>
</html>